local _class = {}
--- 入口
--- @public
TAG = "FromLua"
WATCH = "com.xmcy.hykb.app.ui.main.MainActivity"; --可以添加多个

function _class:setup(t)

    app:matchWindow(function(event)
        clickedByText("跳过")
        return false;
    end)

    app:watch(function(event)
        Log:i(TAG, "event:" .. event:getClassName());
        if event:getClassName() == WATCH then
            WATCH="";--
            clickedByText("我的");
            clickedByText("游戏管理");
            clickedById("com.xmcy.hykb:id/navigate_back");

        end

    end)
end


function clickedByText( name)
    app:sleep(1000);
    local node = Rule():text(name):findOne(); --查找节点
    --通过手势来点击
    if node ~=nil then
        gesture:clicked(node:centerX(),node:centerY(),0);
    end
end

function clickedNode(node)
    if node:canClicked() == true then
        node:clicked();
    else
        clickedNode(node:getParent());--使用父节点点击 注意该方法是往上递归 一定要确定父类的clicked是否为ture
    end
end
return _class
